package jdbc;

import java.sql.*;


/**
 * @author huangliusong
 * @since 2018/11/3
 * {@link JdbcUtil}
 */
public class Test {
    public static void main(String[] args) throws Exception {
        long startTime=System.currentTimeMillis();
        Connection connection=null;
        PreparedStatement preparedStatement=null;

        connection=JdbcUtil.getConnection();
        System.err.println(connection);
        JdbcUtil.begin(connection);

        String sql="insert into t_user(username,address) values(?,?)";
        preparedStatement=connection.prepareStatement(sql);


        for (int i=0;i<10000;i++){
            preparedStatement.setString(1,"hello "+(i+1));
            preparedStatement.setString(2,"1111"+(i+1));
            preparedStatement.executeUpdate();
        }

        JdbcUtil.commit(connection);

       // connection.commit();
        long endTime=System.currentTimeMillis();

        System.out.println(endTime-startTime+"ms");
    }


}
